<%@page contentType="text/html; charset=ISO-8859-1" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html>
<head>
<title>Forget Password</title>

<link rel="stylesheet" type="text/css" href="css/loginstyle.css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/ddaccordion.js"></script>
<script language="javascript" type="text/javascript" src="js/niceforms.js"></script>
<link rel="stylesheet" type="text/css" media="all" href="css/niceforms-default.css" />
<style type="text/css">

.close {
    background-color: rgba(0, 0, 0, 0.8);
    height: 30px;
    line-height: 30px;
    position: absolute;
    right: 389px;
    text-align: center;
    text-decoration: none;
    top: 126px;
    width: 30px;

    -webkit-border-radius: 15px;
    -moz-border-radius: 15px;
    -ms-border-radius: 15px;
    -o-border-radius: 15px;
    border-radius: 15px;
}
.close:before {
    color: rgba(255, 255, 255, 0.9);
    content: "X";
    font-size: 24px;
    text-shadow: 0 -1px rgba(0, 0, 0, 0.9);
}
.close:hover {
    background-color: rgba(64, 128, 128, 0.8);
}
</style>
<script type="text/javascript">
	ddaccordion.init({
		headerclass : "submenuheader", 
		contentclass : "submenu", 
		revealtype : "click", 
		mouseoverdelay : 200, 
		collapseprev : true, 
		defaultexpanded : [], 
		onemustopen : false, 
		animatedefault : false, 
		persiststate : true, 
		toggleclass : [ "", "" ], 
		togglehtml : [ "suffix",
				"<img src='images/plus.gif' class='statusicon' />",
				"<img src='images/minus.gif' class='statusicon' />" ], 
		animatespeed : "fast", 
		oninit : function(headers, expandedindices) { 
		},
		onopenclose : function(header, index, state, isuseractivated) { 
		}
	});

	
	$(document).ready(function() {
		
		 $('#cpwd').live("paste",function(e) {
			 e.preventDefault();
		 });

		 $('#pwd').live("cut copy paste",function(e) {
			 e.preventDefault();
			});

		var error=false;
		$("#save").click(function(event) { 
			alert("hii");
			if((document.getElementById('uname').value)=='' || (document.getElementById('pwd').value)=='' || (document.getElementById('cpwd').value)==''){
				error	=	true;
				 document.location.href="/nepalcmx/forgotPwd";
			}
			
			if(error==false){
			var reqUrl="./user/ForgetPwd";
			var p1=$("#pwd").val();  
			var p2=$("#cpwd").val();
			if(p1==p2){
				var jsondata = JSON.stringify({ "password":$("#pwd").val(),"userId":$("#uname").val()});
				$.ajax(
			  	{
			 	 type: "POST",
			 	 url: reqUrl,
			  	dataType: "json",
			  	contentType: 'application/json',	  
			  	data:jsondata, 
			  	success: function(jsonResponse) { 
				 	alert(jsonResponse);
				 	alert(jsonResponse["msg"]);
				 	document.getElementById("uname").value="";
				  	document.getElementById("pwd").value="";
				  	document.getElementById("cpwd").value="";
			  } 
			});alert("Password SuccessFully Created");
			 //event.preventDefaults();
			}else{
				alert("Password Field does not matches with Confirm Password.");
			}
			}
		});
	});
	
</script>
</head>
<body >
<div id="main_container">

	<div class="header_login">
    <div class="logo"><a href="#"><img src="img/ncmx-logo.png" alt="" title="" border="0" width="200" height="70"/></a></div>
    
    </div>
    <div class="login_form" >
	<h3 style="font-family: 'Monotype Corsiva';font-size: 23px;font-weight: bold">Forgot Password</h3>
	
	<form name='f' action='/nepalcmx' method="post" class="niceform" accept-charset="utf-8">
		<table style="margin-left:63px;margin-top:50px; border:none; clear:both;width:695px;">
	
			<tr>
				<td style="font-family: 'Monotype Corsiva';font-size:18px; font-weight:bold; color:navy;">UserID:</td>
				<td style="float:left; width:400px; margin:0 0 10px 0;">
				<input type='text' name='username' value='' id="uname" placeHolder="Enter Your ID" required="true" size="30"/></td>
			</tr>
			<tr>
				<td style="font-family: 'Monotype Corsiva';font-size:18px; font-weight:bold; color:navy;">New Password:</td>
				<td style="float:left; width:400px; margin:0 0 10px 0;">
				<input type='password' name='password' id="pwd" placeHolder="Enter New Password" required="true" size="30"/></td>
			</tr>
			<tr>
				<td style="font-family: 'Monotype Corsiva';font-size:18px; font-weight:bold; color:navy;">Confirm Password:</td>
				<td style="float:left; width:400px; margin:0 0 10px 0;">
				<input type='password' name='cpassword' id="cpwd" placeHolder="Confirm Your Password" required="true" size="30"/></td>
			</tr>
			<tr>
			<td></td>
				<td colspan='2' style="clear:both; width:500px; text-align:left; padding:0 0 0 10px;">
				<input name="submit" type="submit" id="save" value="Save" style="width: 81px;"  /></td>
			</tr>		
		</table>
		<a class="close" id="close" href="index"></a>  
	</form>
	</div> 
	</div> 
</body>
</html>